<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%> 
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<sx:head/>
<script type="text/javascript">
djConfig = {
    scopeMap: [
        ["dojo", "coolio"],
        ["dijit", "cooliow"],
        ["dojox", "cooliox"],
    ],
    modulePaths: {
        "coolio.actions": "../coolio/actions"
    },
    bindEncoding: "UTF-8",
    parseOnLoad : true,
    _hasResource: [],
    searchIds: []
};
</script>
<script type="text/javascript" src="<%=basePath%>javascript/dojo/dojo/dojo.js"></script>
<script type="text/javascript" src="<%=basePath%>javascript/dojo/dojox/timing/_base.js"></script>
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="../stylesheet/layout.css" />
<script type="text/javascript" src="<%=basePath%>javascript/footer_script.js"></script>
<script>
var request_count=-1;
var notification_count=-1;
var t = new cooliox.timing.Timer();
t.setInterval(3000);
t.onTick = function() {
	get_update('<%=basePath%>');
};
t.start();
get_update('<%=basePath%>');
</script>
<script type="text/javascript">
	dojo.addOnLoad(function() {
		dojo.event.topic.subscribe('addFriendRequest', this,
				function(data, type, e) {
					if (type == 'load') {
						alert('Request has been sent!');
					} else if (type == 'error') {
						alert('Cannot send the request!');
					}
				});
	});
</script>
</head>
<body>
	<jsp:include page="../common/header.jsp"></jsp:include>
	<jsp:include page="../common/navigator.jsp"></jsp:include>
	<div id="main">
	<s:property value="#session.login.id"/>
	<s:property value="user.id"/>
	<s:if test="#session.login.id != user.id && !friend">
	<s:url id="addFriend" action="create_request" namespace="/request"><s:param name="requestType">add_friend</s:param><s:param name="responserId"><s:property value="user.id"/></s:param></s:url>
	<sx:a href="%{addFriend}" notifyTopics="addFriendRequest">Add Friend</sx:a>
	</s:if>
	<s:property value="notice"/>
	<table>
		<tr>
			<td>name</td>
			<td><s:property value="user.name" /></td>
		</tr>
		<tr>
			<td>email</td>
			<td><s:property value="user.email" /></td>
		</tr>
		<tr>
			<td>age</td>
			<td><s:property value="user.age" /></td>
		</tr>
		<tr>
			<td>university</td>
			<td><s:property value="user.university" /></td>
		</tr>
		<tr>
			<td>gender</td>
			<td><s:property value="user.gender" /></td>
		</tr>
		<tr>
			<td>description</td>
			<td><s:property value="user.description" /></td>
		</tr>
		<tr>
				<td>expert field</td>
				<td>
				<s:iterator value="user.experts">
				<span id="expertTag<s:property value='id'/>"><s:property value="name"/></span>
				</s:iterator>
				</td>
			</tr>
			<tr>
				<td>interest field</td>
				<td>
				<s:iterator value="user.interests">
				<span id="interestTag<s:property value='id'/>"><s:property value="name"/></span>
				</s:iterator>
				</td>
			</tr>
	</table>
	<s:if test="user.id!=#session.login.id">
	<a href="<s:url action="send_input" namespace="/message"><s:param name="receiverId"><s:property value="user.id"/></s:param></s:url>">New Message</a>
	</s:if>
	</div>
	<jsp:include page="../common/footer.jsp"></jsp:include>
</body>
</html>